import 'package:flutter_notification_listener/flutter_notification_listener.dart';

class WeChatMessage{
  //{"infoText":null,"canTap":true,"title":"道通_王强","subText":null,"uid":10305,"showWhen":true,"package_name":"com.tencent.mm","text":"[2条]道通_王强: 腊安居","id":-386678945,"_id":"29e4fa99730fa","actions":null,"channelId":"message_channel_1659502588942","key":"0|com.tencent.mm|-386678945|null|10305","timestamp":1682662261138,"hasLargeIcon":true}
  late String title;
  late String text;
  late String packageName;  //com.tencent.mm
  late int timestamp;
  late String timeStr;
  WeChatMessage.fromJson(dynamic json){
    title = json["title"]??'';
    text = json["text"]??'';
    packageName = json["package_name"]??'';
    timestamp = json["timestamp"]??0;
    timeStr = DateTime.fromMillisecondsSinceEpoch(timestamp).toString().substring(0,12);
  }
    WeChatMessage.parse(NotificationEvent event){
    title = event.title??'';
    text =  event.text??'';
    packageName = event.packageName??'';
    timestamp = event.timestamp??0;
    timeStr = DateTime.fromMillisecondsSinceEpoch(timestamp).toString().substring(0,12);
  }
  @override
  String toString() {
    return 'WeChatMessage{title: $title, text: $text, packageName: $packageName, timestamp: $timestamp}';
  }
}
const  targetPackageName = 'com.tencent.mm';
// const  targetPackageName = 'android';
const  targetKeyWordList = ['长虹'];
